package com.fishingwithme.infrastructure.dtos;

import com.fishingwithme.domain.common.Location;
import com.fishingwithme.domain.spots.ParkingDistance;
import com.fishingwithme.infrastructure.utils.CommonUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

@Data
public class SpotNavDto implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    private Long id;
    private Boolean isFree;

    private Boolean isParkingConvenient;

    @JsonIgnore
    private String distance;
    private ParkingDistance distanceVal;

    private Boolean isPrivate;
    private Double longitude;
    private Double latitude;
    @JsonIgnore
    private String navLine;
    private List<Location> line;

    private String name;
    private String city;

    public SpotNavDto format() {
        this.setDistanceVal(ParkingDistance.valueOf(this.getDistance()));
        this.setLine(CommonUtils.convert(this.getNavLine(), Location.class));
        return this;
    }
}
